<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">
    <title th:text="${title}"></title>

    <div th:include="/common/layui"></div>
    <div th:include="/common/jq"></div>

    <!--添加 vue  支持加载-->
    <script src="/vue/vue.min.js"></script>
    <!--添加 vue  支持加载-->

    <style>
        .layui-form-item {
            margin-bottom: 3px;
        }
    </style>
</head>

<script  th:inline="javascript">
    /*<![CDATA[*/
    $(function(){
        if("[[${book?.bookType?.id}]]"!="null"){
            $("#bookTypeId").val([[${book?.bookType?.id}]]);
        }
    });


    var save_url = [[${save_url}]];
    function borrow() {
        var index = layer.msg('提交中，请稍候', {
            icon : 16,
            time : false,
            shade : 0.8
        });
        var bookTypeId = $("#bookTypeId").val();
        /*bianhao:app.bianhao,name:app.name,danjia:app.danjia,author:app.author,press:app.press,orderNo:app.orderNo,'bookType.id':bookTypeId*/
        $.post(save_url, {username:app.name,bookId:app.bookId
        }, function(result) {
            if (result.success) {
               window.parent.closeDlg(result.msg);
            } else {
                layer.msg(result.msg);
            }
        }, 'json');
    }

    /*]]>*/
</script>
<body id="app">
<div style="padding: 10px;" class="layui-form layui-form-pane" action="">

    <div><input type="hidden" v-model="bookId" th:value="${bookId}"></div>

    <div class="layui-form-item">
        <label class="layui-form-label">借书人</label>
        <div class="layui-input-block">
            <input type="text"  v-model="name" th:value="${book?.name}"  autocomplete="off"
                   placeholder="请输入  借书人姓名" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" th:text="${btn_text}"  lay-submit="" lay-filter="demo1"
                    onclick="borrow()"></button>
        </div>
    </div>
</div>

</body>

<script th:inline="none">
    layui.use([ 'laydate', 'laypage', 'layer', 'table', 'carousel', 'upload',
        'element' ], function() {
        var laydate = layui.laydate //日期
            , laypage = layui.laypage //分页
            , layer = layui.layer //弹层
            , table = layui.table //表格
            , carousel = layui.carousel //轮播
            , upload = layui.upload //上传
            , element = layui.element; //元素操作

    });
</script>

<script>
    var app = new Vue({
        el : '#app',
        data : {
        }
    });
</script>
</html>